package com.google.code.swingonfire.utility.date;

import java.awt.geom.Rectangle2D;
import java.util.Calendar;

class DateRendererDayPart extends AbstractDateRenderPart
{

    private static final String[] VALUES = {"00", "11", "22", "33", "44", "55", "66", "77", "88", "99"};

    public DateRendererDayPart(DateRenderer info)
    {
        super(info);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected Rectangle2D computeMaximumBounds(DateRendererContext context, DateFormatStyle style)
    {
        return findMaximumBounds(context, VALUES);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected String getValue(DateRendererContext context, DateFormatStyle style, Calendar calendar)
    {
        return String.format("%02d", calendar.get(Calendar.DAY_OF_MONTH));
    }

}
